home *** CD-ROM | disk | FTP | other *** search
- /*
- ** File: Main.c
- **
- ** Written by: Bill Hayden
- ** Nikol Software
- **
- ** Copyright © 1995 Nikol Software
- ** All rights reserved.
- */
-
-
-
- #include "AEHandler.h"
- #include "Failure.h"
- #include "wt.h"
- #include "MacWT.h"
- #include "Constants.h"
- #include "Menu.h"
- #include "StringUtils.h"
- #include "Init.h"
- #include "FileUtils.h"
- #include "Networking.h"
- #include "Event.h"
-
-
-
- // profiling code
- #if __profile__
-
- #include "Profiler.h"
-
- #if GENERATINGPOWERPC
- #define SUFFIX "PPC"
- #else
- #define SUFFIX "68K"
- #endif
-
- #endif
-
-
- EventRecord gTheEvent;
- Boolean quitting = false;
- Boolean gPaused = false;
- Boolean gShowFPS = true;
- Boolean gGameOn = false;
- Boolean gTrueColor = false;
- Boolean gKeyboardControl = true;
- Boolean gUseQuickdraw = true;
- Boolean gDrawFC = true;
- short gScreenDepth = 0;
- short gCurrentDepth = 0;
- short gSizeOfPixel = 1;
- Str255 gWorldFile = "\p";
- Str15 gWTVersion = "\pUnknown";
- OSErr gNetworkErr = noErr;
-
- #if __ppcc
- QDGlobals qd;
- #endif
-
-
-
-
- /*****************************************************************************/
-
-
-
- void main(void)
- {
- KeyMap kmap;
- unsigned char *kmp = (unsigned char *)&kmap;
- NamesTableEntry appNTE;
- EntityName appEntityName;
-
-
- MaxApplZone(); // Expand the heap so code segments load at the top.
- Initialize(32, kMinHeap, kMinSpace); // Initialize the program.
-
- GetKeys(kmap);
- if MacKeyDown(kmp, 0x3A) QuitEverythingButMe(); // option key quits all other apps
-
- InitAppleEvents();
- DoAdjustMenus();
-
- #if GENERATING68K
- UnloadSeg((Ptr)Initialize); // Initialize can't be in Main Segment!
- #endif
-
- while (ProcessEvent()) {}; // Handle 'odoc' AppleEvent et al.
-
- InitMacWT();
-
- gNetworkErr = AddPPCNBPAlias(&appNTE, "\pMacWT", &appEntityName);
-
- #if __profile__
- if (!ProfilerInit(collectDetailed, bestTimeBase, 20, 5))
- {
- #endif
-
- EventLoop();
-
- #if __profile__
- ProfilerDump("\pMacWT(" SUFFIX ").prof");
- ProfilerTerm();
- }
- #endif
-
- DisposeMacWT();
-
- if (!gNetworkErr) RemoveNBPAlias(&appEntityName);
- }
-